<?php
namespace Usap\Model;
use Think\Model;
class BaseModel extends Model{
	
	public function _initialize(){
		$this->tableName = $this->con_info_cfg['db_tablename'];
		$this->tabPrefix = $this->con_info_cfg['db_tableprefix'];
		
		$link_info =  C('db_pool.'.$this->con_info_cfg['pool_dbname']);
		$this->dbName = $link_info['db_name'];

		if(link_info){
			C('DB_PREFIX',$link_info['DB_PREFIX']);
			$this->connection = $link_info;
		}
	}
	
	public function returnMsg($code){
		$cfg = array(
				'0000'=>'处理成功',
				
				'9999'=>'参数格式有误',
				'9990'=>'数据库更新失败',
				'9991'=>'数据库记录删除失败',
		);
		$code = array_key_exists($code, $cfg) ? $code : '-9999';
		$msg = isset($cfg[$code]) ? $cfg[$code] : '';
		return array('code'=>$code,'msg'=>$msg);
	}
}